<%@ page import="com.study.system.log.domain.UserLog" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.util.List" %>
<%@ page import="com.study.system.log.service.Impl.LoginServiceImpl" %>
<%@ page import="com.study.system.utils.DataUtils" %><%--
  Created by IntelliJ IDEA.
  User: 86176
  Date: 2022/4/20
  Time: 17:38
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <meta charset="UTF-8">
    <title>打卡管理系统</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/bootstrap.min.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/bootstrap-theme.min.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/bootstrap-admin-theme.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/bootstrap-admin-theme.css">

    <script src="${pageContext.request.contextPath}/static/js/bootstrap.min.js"></script>
    <script src="${pageContext.request.contextPath}/static/js/bootstrap-dropdown.min.js"></script>

</head>
<body>
<%--导入js--%>
<script src="${pageContext.request.contextPath}/static/js/axios-0.18.0.js"></script>
<script src="${pageContext.request.contextPath}/static/js/bootstrap.min.js"></script>

<%@include file="admin_header.jsp" %>

<%

%>

<div class="container">
    <div class="row">
        <%@include file="admin_means.jsp" %>
        <!-- content -->
        <div class="col-md-10">
            <div class="row">
                <div class="col-lg-12">
                    <div class="panel panel-default bootstrap-admin-no-table-panel">
                        <div class="panel-heading">
                            <div class="text-muted bootstrap-admin-box-title">打卡记录</div>
                        </div>

                    </div>
                </div>
            </div>
            <div class="row">
                <div class="col-lg-12">
                    <table id="data_list" class="table table-hover table-bordered" cellspacing="0" width="100%">
                        <thead>
                        <tr>
                            <th>编号</th>
                            <th>打卡时间</th>
                            <th>打卡人姓名</th>
                            <th>打卡人部门</th>
                            <th>状态</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <%
                            //查询数据
                            LoginServiceImpl service1 = new LoginServiceImpl();
                            List<UserLog> logs = service1.selectAllLog();
                            for (UserLog log : logs) {
                        %>
                        <tbody>
                        <td><%= log.getId() %>
                        </td>
                        <td><%= DataUtils.getStringDate(log.getDate())%>
                        </td>
                        <td><%= log.getName() %>
                        </td>
                        <td><%= log.getDept() %>
                        </td>
                        <td><%= log.getStatus()%>
                        </td>
                        <td>
                            <button type="button" class="btn btn-warning btn-xs" data-toggle="modal"
                                    data-target="#updateModal"
                                    id="btn_update" onclick="dellog(<%= log.getId() %>)">删除
                            </button>
                        </td>
                        </tbody>
                        <%} %>
                        <tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>

<script type="text/javascript">
    function dellog(hid) {
        con = confirm("是否删除?");
        if (con == true) {
            location.href = "${pageContext.request.contextPath}/log/delLog?id=" + hid;
        }
    }
</script>

</body>
</html>